<{foreach from=$data.tuan item=item}>
<div class="tuanzhuang_show">
    <a target="_blank" title="<{$item.title}>" href="<{link ctl='home:tuanDetail' arg0=$item.tuan_id}>"><img src="<{$pager.img}>/<{$data.home_list[$item.home_id].face_pic}>" width="220" height="155" /></a>
    <div class="tuanzhuang_time">
        <span></span>
        <p class="jq_endtime" value='<{$item.end_time}>'>剩余时间倒计时</p>
    </div>
    <a target="_blank" title="<{$item.title}>" href="<{link ctl='home:tuanDetail' arg0=$item.tuan_id}>" class="tuanzhuang_name"><{$item.title}></a>
    <div class="tuanzhuang_join">
        <p>
            立省<i>￥<{$item.jieyue}></i>元
        </p>
        <a target="_blank" title="<{$item.title}>" href="<{link ctl='home:tuanDetail' arg0=$item.tuan_id}>" class="now_cantuan">立即参团</a>      
    </div>
    <div class="cl"></div>
    <p class="rt mr10"><i><{$item.sign_num}></i>人已经参团</p>
</div>
<{/foreach}>

<script>
    $(document).ready(function() {
        $(".tuanzhuang_show").mouseover(function() {
            $(this).find(".tuanzhuang_time").addClass("currentred");
        })
        .mouseout(function() {
            $(this).find(".tuanzhuang_time").removeClass("currentred");
        });
        var dateTime = new Date();
                var difference = dateTime.getTime() ;
                setInterval(function() {
                    $(".jq_endtime").each(function() {
                        var obj = $(this);
                        var endTime = new Date(parseInt(obj.attr('value')) * 1000);
                        var nowTime = new Date();
                        var nMS = endTime.getTime() - nowTime.getTime() + difference;
                        var myD = Math.floor(nMS / (1000 * 60 * 60 * 24));
                        var myH = Math.floor(nMS / (1000 * 60 * 60)) % 24;
                        var myM = Math.floor(nMS / (1000 * 60)) % 60;
                        var myS = Math.floor(nMS / 1000) % 60;
                        if (myD >= 0) {
                            if(myS % 3 == 0){
                                obj.parent().parent().find(".tuanzhuang_time").addClass("currentred");
                            }else{
                                obj.parent().parent().find(".tuanzhuang_time").removeClass("currentred");
                            }
                            var str = myD + "天" + myH + "小时" + myM + "分" + myS + "秒";
                        } else {
                            var str = "已结束！";
                        }
                        obj.html(str);
                    });
                }, 1000);
        
    });
</script>   